package com.space.school.services.impl;

import com.space.school.dao.LoginDao;
import com.space.school.dao.impl.LoginDaoImpl;
import com.space.school.domain.User;
import com.space.school.services.LoginService;

public class LoginServiceImpl implements LoginService {
    private LoginDao loginDao = new LoginDaoImpl();
    @Override
    public boolean login(String username, String password) {
//        登录校验 通过dao 访问数据库后将值进行返回,
//        看是否有值,有值则登录成功
        //调用登录方法
        User user = loginDao.login(username, password);
        if (user != null) {
            return true;
        }
        return false;
    }
    //   当账户存在,密码错误的时候,提示你的密码输入错误
    @Override
    public boolean validPassword(String username) {
        User user = loginDao.validPassword(username);
        if (user != null) {
            return true;
        }
        return false;
    }

}
